package com.shujia.wyh;

import com.shujia.wyh.utils.MySqlTool;

import java.sql.PreparedStatement;
import java.sql.ResultSet;

/*
    模糊查询
 */
public class JDBCDemo7 {
    public static void main(String[] args) throws Exception {
        String sql = "select ename from emp where ename like ?";
        PreparedStatement statement = MySqlTool.getStatement(sql);
        statement.setString(1, "%A%");
        ResultSet resultSet = statement.executeQuery();

        while (resultSet.next()){
            String name = resultSet.getString(1);
            System.out.println(name);
        }
    }
}
